package com.hq.controller;

import com.github.pagehelper.PageInfo;
import com.hq.pojo.Appointment;
import com.hq.pojo.Doctor;
import com.hq.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/doctor")
public class DoctorController {

    @Autowired
    private DoctorService doctorService;

    //查询体检人信息
    @RequestMapping("/selectAllMaser")
    @ResponseBody
    public PageInfo<Appointment> selectAllMaser(int pageNum, int pageSize, String doctorName) {
        if (pageNum == -1)
            pageNum = 1;
        return doctorService.selectAllMaser(pageNum, pageSize, doctorName);
    }

    //医生自己查看自己的个人信息
    @RequestMapping("/queryMyInformation")
    @ResponseBody
    public PageInfo<Doctor> QueryMyInformation(String username) {
        return doctorService.queryMyInformation(username);
    }

    //删除一个体检人
    @RequestMapping("/delOne")
    public void delAppointment(Integer appointId) {
        doctorService.delOne(appointId);
    }



    //修改个人信息
    @RequestMapping("/updateDoctor")
    @ResponseBody
    //    修改医生个人信息
    public Map<String, String> updateDoctor(Doctor doctor) {
        return doctorService.updateDoctor(doctor);
    }

}
